// ActionScript file
package com.app.commands{
	import com.adobe.cairngorm.commands.ICommand;
	import com.adobe.cairngorm.control.CairngormEvent;
	import com.app.business.MahasiswaDelegate;
	import com.app.control.GetInfoMahasiswaEvent;
	import com.app.model.ModelLocator;
	import com.app.vo.MahasiswaVO;
	
	import mx.controls.Alert;
	import mx.rpc.IResponder;
	

    public class GetInfoMahasiswaCommand implements  ICommand,IResponder{
        private var model:ModelLocator=ModelLocator.getInstance();
        public function execute (event : CairngormEvent):void{
            model.mahasiswa.isPending=true;
            var delegate:MahasiswaDelegate=new MahasiswaDelegate(this);
            var getInfoMhs:GetInfoMahasiswaEvent = GetInfoMahasiswaEvent(event);
            delegate.getInfoMahasiswa(getInfoMhs.mahasiswaVo);
        }
        public function result(data:Object):void{
            model.mahasiswa.isPending=true;
            model.mahasiswa.mahasiswaVo=MahasiswaVO(data);
        }
        
        public function fault(info:Object):void{
            Alert.show( "Get Info Mahasiswa Failed","Alert");
            model.mahasiswa.isPending = false;
        }
    }
    
}